package com.jh.wdbc.controller;

import java.util.ArrayList;
import java.util.List;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.jh.wdbc.model.ConnectionInfo;
import com.jh.wdbc.model.MapList;
import com.jh.wdbc.service.ConnectionManager;

@Controller
public class MonitorConroller {
	
	@RequestMapping("/monitor")
	public String monitor(Model model){
		MapList<ConnectionInfo> connections = ConnectionManager.connections;
		List<List<ConnectionInfo>> list = new ArrayList<List<ConnectionInfo>>();
		for(String key : connections.keySet()){
			list.add(connections.getListForKey(key));
		}
		model.addAttribute("list", list);
		return "monitor";
	}
}
